﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="X.WebSite._Default"
    MasterPageFile="~/Master/Master.Master" %>

<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" ID="cph" runat="server">
    <script type="text/javascript">
        $(function () {
            var len = $(".num > li").length;
            var index = 0;
            var adTimer;
            $(".num li").mouseover(function () {
                index = $(".num li").index(this);
                showImg(index);
            }).eq(0).mouseover();
            //滑入 停止动画，滑出开始动画.
            $('.ad').hover(function () {
                clearInterval(adTimer);
            }, function () {
                adTimer = setInterval(function () {
                    showImg(index)
                    index++;
                    if (index == len) { index = 0; }
                }, 2000);
            }).trigger("mouseleave");
        })
        // 通过控制top ，来显示不同的幻灯片
        function showImg(index) {
            var adHeight = $(".ad").height();
            $(".slider").stop(true, false).animate({ bottom: -adHeight * index }, 1000);
            $(".num li").removeClass("on")
			.eq(index).addClass("on");
        }
    </script>
    <style type="text/css">
        .ad { margin-bottom: 10px; width: 775px; height: 257px; overflow: hidden; position: relative; }
        .slider, .num { position: absolute; }
        .slider li { list-style: none; display: inline; }
        .slider img { width: 775px; height: 257px; display: block; }
        .num { right: 5px; bottom: 5px; }
        .num li { float: left; color: #069; text-align: center; line-height: 16px; width: 16px; height: 16px; font-family: Arial; font-size: 12px; cursor: pointer; overflow: hidden; margin: 3px 1px; border: 1px solid #069; background-color: #fff; }
        .num li.on { color: #fff; line-height: 16px; width: 16px; height: 16px; font-size: 14px; margin: 3px 1px; border: 1px solid #069; background-color: #069; font-weight: bold; }
    </style>
    <div style="float: left;">
        <div class="ad">
            <ul class="slider">
                <%
                    string strNum = string.Empty;
                    System.Collections.Generic.IList<X.Entity.AdInfo> lstAd = X.Bll.Ad.GetList(4);

                    if (lstAd.Count == 0)
                    {
                        X.Entity.AdInfo adInfo = new X.Entity.AdInfo();

                        adInfo.AdLink = "http://" + SiteInfoConfig.SiteUrl;
                        adInfo.AdImage = "Banner.jpg";
                        adInfo.AdName = SiteInfoConfig.SiteName;

                        lstAd.Add(adInfo);
                    }

                    for (int i = 0; i < lstAd.Count; i++)
                    {
                        Response.Write(string.Format("<li><a href=\"{0}\"><img src=\"/Upload/{1}\" alt=\"{2}\" /></a></li>", lstAd[i].AdLink, lstAd[i].AdImage, lstAd[i].AdName));

                        strNum += string.Format("<li>{0}</li>", i + 1);
                    }
                
                %>
            </ul>
            <ul class="num">
                <%
                    Response.Write(strNum);
                %>
            </ul>
        </div>
    </div>
    <div style="height: 4px; display: block;">
    </div>
    <table border="0" cellpadding="0" cellspacing="0" width="775px">
        <tr>
            <td style="width: 5px;">
                <img src="/Images/lc.gif" alt="" />
            </td>
            <td style="background: url('/Images/mb.gif') repeat-x; width: 774px;">
                <span style="color: #fff; font-size: 18px; font-weight: bold; padding-left: 25px;">Products</span>
            </td>
            <td style="width: 4px;">
                <img src="/Images/rc.gif" alt="" />
            </td>
        </tr>
    </table>
    <div style="background: url('Images/plbg.gif') no-repeat; padding: 4px;">
        <table border="0" cellpadding="0" cellspacing="0">
            <%
                System.Collections.Generic.IList<X.Entity.ProductInfo> list = X.Bll.Product.GetHotList(10);

                for (int i = 0; i < list.Count; i++)
                {
                    if (0 == i % 5)
                        Response.Write("<tr>");

                    Response.Write("<td style=\"height:170px;text-align:center;width:150px;\" valign=\"top\">");
                    Response.Write(string.Format("<a href=\"/Product/{0}/{1}.aspx\" title=\"{2}\">"
                        , X.Common.StringUtils.StringToUrl(list[i].CategoryName, list[i].CategoryId)
                        , X.Common.StringUtils.StringToUrl(list[i].ProductName, list[i].ProductId)
                        , X.Common.StringUtils.HtmlDecode(list[i].ProductName)));
                    Response.Write(string.Format("<img src=\"/Upload/{0}\" alt=\"{1}\" height=\"105px\" width=\"105px\" style=\"border:1px solid #cacaca;\"></a><br />"
                        , list[i].Photo[0].ImageNameEx
                        , X.Common.StringUtils.HtmlDecode(list[i].ProductName)));
                    Response.Write(string.Format("<a href=\"/Product/{0}/{1}.aspx\" title=\"{2}\">{3}</a>"
                        , X.Common.StringUtils.StringToUrl(list[i].CategoryName, list[i].CategoryId)
                        , X.Common.StringUtils.StringToUrl(list[i].ProductName, list[i].ProductId)
                        , X.Common.StringUtils.HtmlDecode(list[i].ProductName)
                        , list[i].ProductName));
                    Response.Write("</td>");

                    if (i == list.Count - 1 && 0 != i % 5)
                    {
                        for (int j = 0; j < 5 - i % 5 - 1; j++)
                        {
                            Response.Write("<td style=\"height:170px;text-align:center;width:150px;\"></td>");
                        }
                    }

                    if (4 == i % 5)
                        Response.Write("</tr>");
                }
            %>
        </table>
    </div>
    <div style="background-color: #f8f7f3; border-top: 1px solid #fe8e20; display: block;
        height: 150px; margin-top: 13px; padding-bottom: 5px; width: 775px;">
        <div style="float: left; padding-left: 69px; padding-right: 50px; padding-top: 25px;
            width: 335px;">
            <XWeb:AboutUs ID="AboutUs1" runat="server" />
        </div>
        <div style="float: left; padding-left: 25px; padding-right: 20px; padding-top: 25px;
            width: 271px;">
            <XWeb:NewsList ID="NewsList1" runat="server" />
        </div>
    </div>
    <script src="/Scripts/kf.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#kf").float({
                delay: 500, //延迟
                position: "rm" //位置
            });
        });
    </script>
    <style type="text/css">
        #kf ul { list-style-type: none; }
        #kf ul li {  height: 25px; line-height: 25px; }
    </style>
    <div id="kf">
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td style="width: 5px;">
                    <img src="/Images/lc.gif" alt="" />
                </td>
                <td style="background: url('/Images/mb.gif') repeat-x;">
                    <b>Online Service</b>
                </td>
                <td style="width: 4px;">
                    <img src="/Images/rc.gif" alt="" />
                </td>
            </tr>
            <tr>
                <td style="background: #f5caa0;">
                </td>
                <td valign="top" style="background: #f5caa0;">
                    <ul>
                        <%
                            System.Collections.Generic.IList<X.Entity.MsnInfo> lstMsn = X.Bll.Msn.GetAvaList();

                            foreach (X.Entity.MsnInfo msnInfo in lstMsn)
                            {
                                switch (msnInfo.AccountType)
                                {
                                    case 0:
                                        break;
                                    case 1:
                                        Response.Write(string.Format("<li><a href=\"http://amos1.taobao.com/msg.ww?v=2&uid={0}=1\" target=\"_blank\">{1}</a></li>", msnInfo.MsnAccount, msnInfo.MsnUsername));
                                        break;
                                    case 2:
                                        Response.Write(string.Format("<li><a href=\"skype:mengsajewel?call\" onclick=\"return skypeCheck();\"><img src=\"http://mystatus.skype.com/smallclassic/{0}\" style=\"border:none;\" alt=\"Call me!\" /></a></li>", msnInfo.MsnAccount));
                                        break;
                                    case 3:
                                        Response.Write(string.Format("<li><a href=\"msnim:chat?contact={0}\" target=\"_blank\">{1}</a></li>", msnInfo.MsnAccount, msnInfo.MsnUsername));
                                        break;
                                    default:
                                        break;
                                }
                            }
                        %></ul>
                </td>
                <td style="background: #f5caa0;">
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
